﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PSE.Tools.WasConfigGenerator
{
    public abstract class BaseConfigGenerator
    {
        protected BaseConfigGenerator()
        {

        }

        public event ErrorEventHandler Error;
        public delegate void ErrorEventHandler(object sender, ErrorEventArgs e);

        public event EventHandler<StatusEventArgs> Status;

        protected void OnError(Exception ex)
        {
            if(Error != null)
                Error(this, new ErrorEventArgs(ex));
        }

        protected void OnStatus(StatusEventArgs e)
        {
            if (Status != null)
                Status(this, e);
        }

        public abstract void Generate(string path);

        protected void ShowInformation(string message, params object[] args)
        {
            OnStatus(new StatusEventArgs(string.Format(message, args)));
        }
        protected void ShowStep(string message, params object[] args)
        {
            OnStatus(new StatusEventArgs(StatusType.Step, string.Format(message, args)));
        }
        protected void ShowSuccess(string message, params object[] args)
        {
            OnStatus(new StatusEventArgs(StatusType.Success, string.Format(message, args)));
        }
    }
}
